package teaching.interfacedemo;

/*
* 智能家居冰箱,接入智能家居系统
*        1.内部类:一个类定义到另一个类的内部,从而成为外部类的一个成员
*          内部类里面可以有成员变量,方法.
*        2.非静态的内部类 非static
* */
public class Fridge implements SmartHome{
    //成员变量
    private int temperature;//温度
    private int height;//高度
    private int width;//宽度

    //定义一个内部类,冰箱的冷冻层
    private class Cold{
        private int coldTemperature;
        private int coldHeight;
        private int coldWidth;
        //成员方法
        public void makeIceCream(){
            System.out.println("雪糕做好了");
        }
    }

    public void makeIceSpace(){
        Cold myCold = new Cold() ;
        myCold.makeIceCream();
        myCold.coldTemperature = -10;
    }

    @Override
    public void showYourFuntion() {
        System.out.println("我是冰箱!");
    }

    @Override
    public boolean connection() {
        System.out.println("冰箱已连接!");
        return false;
    }

    public int getTemperature() {
        return temperature;
    }

    public void setTemperature(int temperature) {
        this.temperature = temperature;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }
}
